<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <style>
        body {
            background-color: lightblue;
        }
        .container {
            width: 400px;
            height: 300px;
            margin: auto;
            border: 1px solid black;
            padding: 20px;
            text-align: center;
        }
        .title {
            font-size: 24px;
            font-weight: bold;
        }
        .input {
            width: 200px;
            height: 30px;
            margin: 10px;
        }
        .button {
            width: 70px;
            height: 30px;
            background-color: green;
            color: white;
            font-size: 18px;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="title">欢迎登陆</div><br>
        <form>
        	<label><input type="radio" name="user_type" value="teacher">老师</label>
    		<label><input type="radio" name="user_type" value="student">学生</label>
    		<br>
            <input class="input" type="text" name="username" id="user" placeholder="用户名">
            <input class="input" type="text" name="password" id="password" placeholder="密码">
            <br><br>
            <button type="button"  class="button" onclick="login_check()">登录</button>
            <button type="button"  class="button" onclick="to_sign()">返回</button>
        </form>
       
    </div>
    <script>
    
    //gender  学生/老师
    //user.value  用户名
    //password.value  密码
	    function login_check(){
	    	var gender=document.querySelector('input[name="user_type"]:checked').value;
    		alert("选择结果:"+gender);
			if(user.value==""){
				alert('输入值不得为空！')
			}
			else if(check()==true){
				to_main();
			}
		};
		function to_main(){
			window.location="main.html";
		}
		function to_sign(){
			window.location="注册.html";
		}
		function check(){
			//在此连接数据库判断该账号是否存在
			if(true){
				//在此验证密码
				if(true){
					return true;}
				else{
					alert('密码错误！');}
			}
			else{
				alert('没有该用户名，请注册！');
			}
			
		};
	</script>
        
</body>
</html>